<?php

$event = $this->event;

foreach($this->vote_info as $thread_id=>$thread){
    $voteImgArr = array();
    if(count($thread) >= 1){
        
        foreach($thread as $phase_id=>$phase){
            $now = time();
            if($phase->vote_start_time <= $now && $phase->vote_end_time >= $now){
                $voteImgArr = $this->imgList[$phase->thid][$phase->pid];
                break;
            }
        }
        
    }
    if(empty($voteImgArr)) $voteImgArr = $this->imgList[$phase->thid][$phase->pid];
    $photo_block_id = $thread_id."_".$phase_id;
    $photo_block_title = $phase->thread_name.($phase->phase_name != ""?" - ".$phase->phase_name:"");

?>                            <!--anh chuong trinh-->
                            <div id="gioithieu">
                           <div class="menu-anh"> Ảnh chương trình </div>
                           <div class="tex-noidung-anh">
                                 <!--Photo Content-->
                                <?php if(is_array($voteImgArr) && count($voteImgArr)>0){?>
                                <ul class="photo-group">
                                <?php 
                                    for($i=0; $i<count($voteImgArr) && $i<4; $i++){
                                        $imgObj = $voteImgArr[$i];
                                    ?>
                                    <li class="photo-item">
                                        <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                            <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                            <?php echo $imgObj->album_name;?>
                                        </a>
                                    </li>
                                <?php 
                                    }    // End of for
                                ?>
                                </ul>
                                <?php } // End of if?>
                                <?php if(is_array($voteImgArr) && count($voteImgArr)>4){?>
                                <ul class="photo-group">
                                <?php 
                                    for($i=4; $i<count($voteImgArr) && $i<8; $i++){
                                        $imgObj = $voteImgArr[$i];
                                    ?>
                                    <li class="photo-item<?php echo $i==4?" clear-left":""; ?>">
                                        <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                            <img src="<?php echo EVENT_IMG_SERVER.$imgObj->thumbnail;?>" />
                                            <?php echo $imgObj->album_name;?>
                                        </a>
                                    </li>
                                <?php 
                                    } // End of for
                                ?>
                                </ul>
                                <?php } ?>
                           </div>
                           <div class="clear"></div>
                           <div class="chitiet"><a href="<?php 
                            echo "http://www.tamtay.vn/event/".$event->short_cut."/votedalbumlist/".$thread_id."/".$phase_id;?>">Xem hết &raquo;</a></div>
                      </div>
<?php } ?>